package cate.game.activity.warorder.msg;

import cate.game.GameBody;
import cate.game.activity.warorder.RoleWarOrder;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBWarOrder;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;


@ClientMsg(title = "战令领取等级奖励 の 请求")
public class WarOrderGetLevelRwdReq implements MsgInput {

    @NoteField("功能id")
    public int funcId;

    @NoteField("等级")
    public int level;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        RoleWarOrder r = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (r == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        EcResult result = r.level.getLevelReward(level);
        cc.getRole().getGame().notice.message(cc.getRole(), result, true);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBWarOrder.GET_LEVEL_RWD_REQ;
    }
}
